<!DOCTYPE html>
<html>
<head>
    <title></title>
    <#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增数据源</a>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改数据源</a>
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除数据源</a>
            <a class="btn btn-default" @click="create_tableInfo">生成表数据</a>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
            <div class="form-group">
                <div class="col-sm-2 control-label">数据源名称</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="databaseinfo.connname" placeholder="数据源名称"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">数据库名称</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="databaseinfo.dbname" placeholder="数据库名称"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">数据库类型</div>
                <div class="col-sm-10">
                    <select name="datasourcetype" id="datasourcetype" v-model="databaseinfo.datasourcetype" class="form-control">
                        <option :value="item.id" v-for="(item,index) in dbArr">{{item.name}}</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">数据库驱动</div>
                <div class="col-sm-10">
                    <select name="drivername" id="drivername" v-model="databaseinfo.drivername" class="form-control">
                        <option value="com.mysql.cj.jdbc.Driver">com.mysql.cj.jdbc.Driver</option>
                        <option value="com.mysql.jdbc.Driver">com.mysql.jdbc.Driver</option>
                        <option value="org.postgresql.Driver">org.postgresql.Driver</option>
                        <option value="oracle.jdbc.driver.OracleDriver">oracle.jdbc.driver.OracleDriver</option>
                        <option value="com.microsoft.sqlserver.jdbc.SQLServerDriver">com.microsoft.sqlserver.jdbc.SQLServerDriver</option>
                    </select>

                    <!--<input type="text" class="form-control" v-model="databaseinfo.drivername" placeholder="数据库驱动"/>-->
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">数据库地址</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="databaseinfo.url" placeholder="数据库地址"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">用户名</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="databaseinfo.username" placeholder="用户名"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">密码</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="databaseinfo.password" placeholder="密码"/>
                </div>
            </div>


            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" id="btnSaveOrUpdate" data-loading-text="保存中..."
                       @click="saveOrUpdate" value="确定"/>
                <input type="button" class="btn btn-primary" id="btnTest" data-loading-text="连接中..."
                       @click="databaseTest" value="测试"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/sys/databaseinfo.js?_${.now?long}"></script>
</body>
</html>